package com.gxa.mapper;

import com.gxa.common.vo.*;
import com.gxa.entity.SysDiagnosis;
import org.apache.ibatis.annotations.Param;

import java.math.BigDecimal;
import java.util.List;

public interface SysDiagnosisMapper {
    int addSysDiagnosis(SysDiagnosis sysDiagnosis);

    List<FindDiagnosis> selectAllDiagnosis();

    int countDrugs(@Param("id") Integer id);

    BigDecimal countDrugsAmount(@Param("id") Integer id);

    List<FindDiagnosis> selectDiagnosisByStatus(@Param("status") Integer status);

    List<FindDiagnosis> findDiagnosisByPatientCondition(String name);

    FindDiagnosis selectDiagnosisById(Integer id);

    int delDiagnosisById(Integer id);

    int delDiagnosisDrugById(Integer id);

    int updateDiagnosisById(SysDiagnosis sysDiagnosis);

    List<DiagnosisDrugVo> selectDiagnosisDrugByDiagnosisId(@Param(value = "diagnosisId")Integer diagnosisId);

    DiagnosisDrugVo selectDiagnosisDrugByDrug(@Param(value = "drugId")Integer drugId,@Param(value = "id")Integer id);

    int updateDiagnosisDrug(@Param(value = "num")Integer num,
                            @Param(value = "id")Integer id);

    int delDiagnosisDrug(@Param(value = "id")Integer id);

    int addDiagnosisDrug(DiagnosisDrugVo diagnosisDrugVo);

    List<CountDiagnosisVo> countDiagnosisByType();

    CountDiagnosisVo countDiagnosis();

    List<CountDiagnosisVo> countDiagnosisDrugs( @Param(value = "type")Byte type);

    List<CountDiagnosisVo> countDiagnosisMonth(@Param(value = "type")Byte type);
    List<CountDiagnosisVo> countDiagnosisMonthDay(@Param(value = "type")Byte type);


    /**
     * 根据状态返回计数
     * @return
     */
    CountStatusVo countDiagnosisByStatus(AttendancePageRequest attendancePageRequest);


    Integer countAllDiagnosis();

    List<CountDiagnosisVo> countWeekDiagnosis();

    Integer selectDiagByMainId(@Param("id") Integer id);

    List<DiagnosisDrugVo> findDiagDrugByCondition(
            @Param("condition")String condition,
            @Param("diagnosisId") Integer diagnosisId);

    /**
     * 根据患者id统计患者诊断数量
     * @param patientId 患者id
     * @return 诊断数量
     */
    Integer countPatient(@Param("patientId") Integer patientId);

}
